package gx.test;

import java.io.Reader;
import java.util.Iterator;
import java.util.List;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;


public class GeneratorMyBatis_test {

//	public static void main(String[] args) throws Exception {
//		String resource = "gx/xml/MapperConfig.xml";
//		Reader reader = Resources.getResourceAsReader(resource);
//		SqlSessionFactory sqlMapper = new SqlSessionFactoryBuilder()
//				.build(reader);
//		SqlSession sqlSession = sqlMapper.openSession();
//
//		gx.model.CityExample pet = new CityExample();
//		pet.or().andDistrictIsNotNull();
//		try {
//			gx.mapper.CityMapper mapper = sqlSession.getMapper(CityMapper.class);
//			List<City> allRecords = mapper.selectByExample(pet);
////			for (City s : allRecords)
////				System.out.println(s);
//			for (Iterator<City> iter = allRecords.iterator();iter.hasNext();){
//				City str = iter.next();
//				System.out.println(str.getId()+" ,"+str.getName()+" ,"+str.getCountrycode()+" ,"+str.getDistrict()+" ,"+str.getPopulation());
//			}
//		} finally {
//			sqlSession.close();
//		}
//	}
}
